sgdk: sprite_eng.h Source File

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

sprite_eng.h
Go to the documentation of this file.

    00001
    00012 #ifndef _SPRITE_ENG_H_
    00013 #define _SPRITE_ENG_H_
    00014
    00015 #include "vdp_pal.h"
    00016 #include "vdp_tile.h"
    00017 #include "vdp_spr.h"
    00018
    00019
    00024 #define SPRITE_CACHE_SIZE           128
    00025
    00030 #define COLLISION_TYPE_NONE     0
    00031
    00035 #define COLLISION_TYPE_BOX      1
    00036
    00040 #define COLLISION_TYPE_CIRCLE   2
    00041
    00055 typedef struct
    00056 {
    00057         s16 y;
    00058         u16 size_link;
    00059     u16 attr;
    00060     s16 x;
    00061 }  VDPSprite;
    00062
    00079 typedef struct
    00080 {
    00081     VDPSprite vdpSprite;
    00082         TileSet *tileset;
    00083 }  FrameSprite;
    00084
    00109 typedef struct
    00110 {
    00111         u16 numSprite;
    00112         FrameSprite **frameSprites;
    00113         u16 numCollision;
    00114         void **collisions;
    00115         s16 w;
    00116         s16 h;
    00117         u8 tc;
    00118         u8 timer;
    00119 } AnimationFrame;
    00120
    00138 typedef struct
    00139 {
    00140         u16 numFrame;
    00141         AnimationFrame **frames;
    00142         u16 length;
    00143         u8 *sequence;
    00144         s16 loop;
    00145 } Animation;
    00146
    00159 typedef struct
    00160 {
    00161         Palette *palette;
    00162         u16 numAnimation;
    00163         Animation **animations;
    00164 } SpriteDefinition;
    00165
    00198 typedef struct
    00199 {
    00200         SpriteDefinition *definition;
    00201         Animation *animation;
    00202         AnimationFrame *frame;
    00203         s16 x;
    00204         s16 y;
    00205         s16 animInd;
    00206         s16 frameInd;
    00207         s16 seqInd;
    00208         u16 timer;
    00209         u16 attribut;
    00210         s16 fixedIndex;
    00211         u32 data;
    00212         s32 visibility;
    00213 } Sprite;
    00214
    00215
    00228 void SPR_init(u16 cacheSize);
    00237 void SPR_end();
    00238
    00243 u16 SPR_isInitialized();
    00244
    00262 void SPR_initSprite(Sprite *sprite, SpriteDefinition *spriteDef, s16 x, s16 y, u16 attribut);
    00274 void SPR_setPosition(Sprite *sprite, s16 x, s16 y);
    00284 void SPR_setAttribut(Sprite *sprite, u16 attribut);
    00296 void SPR_setAnimAndFrame(Sprite *sprite, s16 anim, s16 frame);
    00297
    00307 void SPR_setAnim(Sprite *sprite, s16 anim);
    00317 void SPR_setFrame(Sprite *sprite, s16 frame);
    00325 void SPR_nextFrame(Sprite *sprite);
    00326
    00337 void SPR_setVRAMTileIndex(Sprite *sprite, s16 index);
    00351 void SPR_setAlwaysVisible(Sprite *sprite, u16 value);
    00365 void SPR_setNeverVisible(Sprite *sprite, u16 value);
    00366
    00368 // *  \brief
    00369 // *      Test if specified sprites are in collision.
    00370 // *
    00371 // *  \param sprite1
    00372 // *      first sprite.
    00373 // *  \param sprite2
    00374 // *      second sprite.
    00375 // *  \return
    00376 // *      TRUE if sprite1 and sprite2 are in collision, FALSE otherwise.
    00377 // */
    00378 //u16 SPR_testCollision(Sprite *sprite1, Sprite *sprite2);
    00379
    00385 void SPR_clear();
    00396 void SPR_update(Sprite *sprites, u16 num);
    00397
    00399 // *  \brief
    00400 // *      Release allocated resources for the specified list of sprite.<br/>
    00401 // *      This actually release all allocated VRAM for sprite tile data.
    00402 // *
    00403 // *  \param sprites
    00404 // *      sprites we want to release.
    00405 // *  \param num
    00406 // *      number of sprites to release.
    00407 // */
    00408 //void SPR_release(Sprite *sprites, u16 num);
    00409
    00410
    00411 #endif // _SPRITE_ENG_H_
    00412

All Classes Files Functions Variables Typedefs Enumerations Defines